package com.langyue.recordmanage.utils.response;

import com.langyue.recordmanage.enums.ResponseCodeEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: web响应结果 构造
 * @Author: wanglang
 * @CreateTime: 2022/4/3
 * @Company:
 */
public class ResponseBuilder {
    public static final String RESPONSE_CODE = "code";
    public static final String RESPONSE_DESC = "desc";
    public static final String RESPONSE_RESULT = "result";

    public static Map<String, Object> build(ResponseCodeEnum codeEnum, Object object){
        Map<String, Object> res = new HashMap<>();
        res.put(RESPONSE_CODE,codeEnum.getCode());
        res.put(RESPONSE_DESC,codeEnum.getDesc());
        res.put(RESPONSE_RESULT,object);
        return res;
    }
}
